package com.infoauto.opc.gateway.service.impl;

import com.infoauto.opc.gateway.dao.EquipmentAbnormalDao;
import com.infoauto.opc.gateway.model.condition.EquipmentAbnormalCondition;
import com.infoauto.opc.gateway.model.gtm4.EquipmentAbnormal;
import com.infoauto.opc.gateway.service.EquipmentAbnormalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备异常
 */
@Service
public class EquipmentAbnormalServiceImpl implements EquipmentAbnormalService {
    @Autowired
    private EquipmentAbnormalDao dao;

    @Override
    public int insert(EquipmentAbnormal equipmentAbnormal) {
        return dao.insert(equipmentAbnormal);
    }

    @Override
    public int update(EquipmentAbnormal equipmentAbnormal) {
        return dao.update(equipmentAbnormal);
    }

    @Override
    public List<EquipmentAbnormal> selectByStates(Integer states) {
        return dao.selectByStates(states);
    }

    /**
     * 查询最新的五条设备异常的记录
     * @return
     */
    @Override
    public List<EquipmentAbnormal> selectEquipmentAbnormal() {
        return dao.selectEquipmentAbnormal();
    }

    @Override
    public List<EquipmentAbnormal> selectPlcAdrrAndRemoveTime(String plcAdrr) {
        return dao.selectPlcAdrrAndRemoveTime(plcAdrr);
    }

    /**
     * 查询设备异常履历2列表
     * @param equipmentAbnormalCondition
     * @return
     */
    @Override
    public List<EquipmentAbnormal> selectEquipmentAbnormalList2(EquipmentAbnormalCondition equipmentAbnormalCondition) {
        return dao.selectEquipmentAbnormalList2(equipmentAbnormalCondition);
    }
}
